<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <base href="#(basePath)"/>
    <title>帮助管理 - 帮助内容列表</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="static/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="static/admin.css" media="all">
</head>
<body>
<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">

            <div class="layui-collapse" lay-filter="test">
                <div class="layui-colla-item">
                    <h2 class="layui-colla-title">搜索条件</h2>
                    <div class="layui-colla-content">

                        <div class="layui-form-item">
                            <div class="layui-inline">
                                <label class="layui-form-label">分类</label>
                                <div class="layui-input-inline">
                                    <select id="helpType" name="helpType" lay-filter="helpType">
                                        <option value="">请选择分类</option>
                                        #for(x : helptype)
                                        <option value="#(x.type)">#(x.type)</option>
                                        #end
                                    </select>
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">标题</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="title" placeholder="请输入标题" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">编辑者</label>
                                <div class="layui-input-inline">
                                    <input type="text" name="editor" placeholder="请输入编辑者" autocomplete="off"
                                           class="layui-input">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">创建时间1：</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="createTimeStart" name="createTimeStart"
                                           placeholder="yyyy-MM-dd HH:mm:ss">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">创建时间2：</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="createTimeEnd" name="createTimeEnd"
                                           placeholder="yyyy-MM-dd HH:mm:ss">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">更新时间1：</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="updateTimeStart" name="updateTimeStart"
                                           placeholder="yyyy-MM-dd HH:mm:ss">
                                </div>
                            </div>
                            <div class="layui-inline">
                                <label class="layui-form-label">更新时间2：</label>
                                <div class="layui-input-inline">
                                    <input type="text" class="layui-input" id="updateTimeEnd" name="updateTimeEnd"
                                           placeholder="yyyy-MM-dd HH:mm:ss">
                                </div>
                            </div>

                            <div class="layui-inline">
                                <button class="layui-btn layuiadmin-btn-list" lay-submit
                                        lay-filter="LAY-web-list-search">
                                    <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                                </button>

                                #auth()
                                <button link="admin/help/addPage" class="layui-btn layuiadmin-btn-list" lay-submit
                                        lay-filter="add" data-type="add">
                                    <i class="layui-icon layui-icon-add-1 layuiadmin-button-btn">增加</i>
                                </button>
                                #end
                            </div>

                        </div>
                    </div>
                </div>
            </div>
        </div>


        <div class="layui-card-body">
            <table id="LAY-web-list" lay-filter="LAY-web-list"></table>
            <script type="text/html" id="table-content-list">
                #auth()
                <a link="admin/help/updatePage" class="layui-btn layui-btn-normal layui-btn-xs" lay-event="update"><i
                        class="layui-icon layui-icon-edit"></i>编辑</a>
                #end
                #auth()
                <a link="admin/help/delete" class="layui-btn layui-btn-danger layui-btn-xs" lay-event="delete"><i
                        class="layui-icon layui-icon-delete"></i>删除</a>
                #end
            </script>
        </div>
    </div>
</div>

<script src="static/layui/layui.js"></script>
<script>
    layui.config({
        base: '#(basePath)' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index', 'laydate', 'table', 'help'], function () {
        var laydate = layui.laydate;
        //日期时间选择器
        laydate.render({
            elem: '#createTimeStart'
            , type: 'datetime'
        });
        laydate.render({
            elem: '#createTimeEnd'
            , type: 'datetime'
        });
        laydate.render({
            elem: '#updateTimeStart'
            , type: 'datetime'
        });
        laydate.render({
            elem: '#updateTimeEnd'
            , type: 'datetime'
        });

        // 表格
        var table = layui.table
            , form = layui.form;

        //监听搜索
        form.on('submit(LAY-web-list-search)', function (data) {
            var field = data.field;

            //执行重载
            table.reload('LAY-web-list', {
                where: field,
                page: {curr: 1}
            });
        });

        //监听添加
        form.on('submit(add)', function (data) {
            parent.layer.open({
                type: 2
                , title: '添加'
                , content: 'admin/help/addPage'
                , maxmin: true
                , area : ['80%', '90%']
                , btn: ['确定', '取消']
                , yes: function (index, layero) {
                    //点击确认触发 iframe 内容中的按钮提交
                    layero.find('iframe').contents().find("#layuiadmin-app-form-submit").click();
                }
            });
        });


    });
</script>
</body>
</html>
